<style>
body {
	height: 100%;
    display: flex;
	justify-content: center;
    flex-direction: column;
	background: url('../addons/jy_kefu/resource/images/chat-bg.png') no-repeat center center fixed;
	-webkit-background-size: cover;
	-moz-background-size: cover;
	-o-background-size: cover;
	background-size: cover;
}
.wap-qrcode-container {
    height: 240px;
    width: 180px;
    border: 1px solid #e4e4e4;
    border-radius: 5px;
    margin-bottom: 20px;
    background-color: #fff;
    padding: 10px;
    text-align: center;
    position: fixed;
    left: 50%;
    top: 100px;
    margin-left: 368px;
}

.wap-qrcode-container p {
    font-size: 14px;
    color: #666;
    line-height: 26px;
}

.wap-qrcode-container .qrcode-image {
    height: 160px;
    width: 160px;
}

.wap-qrcode-container canvas {
    height: 158px;
    width: 158px;
    border: 1px solid #ddd;
}
.sub-btn{width:42px;line-height:30px;text-align:center;float: right;background: #00a3f0;color: #fff;border-radius: 0.2rem;margin:0 0.1rem 0.2rem 0}
</style>
<link href="../addons/jy_kefu/resource/css/chat.css?v=5" rel="stylesheet">
<div class="fui-page">
<div class="fui-content" style="overflow:hidden;max-width: 950px;min-width: 820px; max-height: 760px;">
<div class="main_content">
  <div class="main_header">
    <div class="tab">
      <div class="tab_item tab_item_selected">
        <span class="chat_item_icon"></span>
        <span>{{pagedata.needanswernum || 0}}</span>
        <span>人待回复</span></div>
      <div ng-click="pagedata.setting_wrap=1" class="tab_item tab_item_right ">
        <span class="fa fa-cog"></span>
      </div>
    </div>
    <div class="state">
      <span ng-if="pagedata.kefu.status==0" class="state_icon online"></span>
	  <span ng-if="pagedata.kefu.status==1" class="state_icon leave"></span>
	  <span ng-if="pagedata.kefu.status==2" class="state_icon fa fa-power-off"></span>
      <span ng-click="pagedata.set_state_popup=1" class="state_description">{{pagedata.member.name}}</span></div>
    <div ng-if="pagedata.set_state_popup==1" class="set_state_popup">
      <div class="state_pic_wrap">
        <img ng-src="{{tomedia(pagedata.member.logo) || '../core/resource/images/nopic.jpg'}}" alt="avatar" data-reactid=".0.5.0.2.0.0"></div>
      <div class="set_state_lists" ng-if="pagedata.iskefu>0">
        <ul>
        <li ng-click="post({'status':0},'setstatus');pagedata.set_state_popup=0" class="set_state_list selected">
            <span class="state_icon online"></span>
            <span>在线</span>
		</li>
        <li ng-click="post({'status':1},'setstatus');pagedata.set_state_popup=0" class="set_state_list">
            <span class="state_icon leave"></span>
            <span>离开</span>
		</li>
        <li ng-click="post({'status':2},'setstatus');pagedata.set_state_popup=0" class="set_state_list">
            <span class="state_icon fa fa-power-off"></span>
            <span>退出</span>
		</li>
        </ul>
      </div>
    </div>
  </div>
  <div class="main_body">
    <div class="chat_wrap" style="display:block;">
      <div class="panel">
        <div class="scroll-wrapper scrollbar-macosx" style="position: relative; height: 100%;">
          <div class="scrollbar-macosx scroll-content" style="height: 700px; margin-bottom: 0px; margin-right: 0px; max-height: none;">
			<div ng-click="pagedata.getchatinfo(item.getmid)" ng-class="{'card':1,'card_selected':pagedata.getmid==item.getmid}" ng-repeat="item in pagedata.list">
			  <div class="card_pic">
				<img src="{{tomedia(item.logo) || '../core/resource/images/nopic.jpg'}}"></div>
			  <div class="card_content">
				<div class="chat_content_header">
				  <span class="card_content_nick">{{item.title || '匿名'}}</span>
				  <span class="card_message_state" ng-show="item.noreadnum > 0">{{item.noreadnum}}</span></div>
				<div class="card_content_chat">
				  <p class="card_content_detail">{{item.lastmsg}}</p>
				  <span class="card_content_time">{{item.lasttime}}</span></div>
			  </div>
			</div>
		  </div>
          <div class="scroll-element scroll-x">
            <div class="scroll-element_outer">
              <div class="scroll-element_size"></div>
              <div class="scroll-element_track"></div>
              <div class="scroll-bar" style="width: 96px;"></div>
            </div>
          </div>
          <div class="scroll-element scroll-y">
            <div class="scroll-element_outer">
              <div class="scroll-element_size"></div>
              <div class="scroll-element_track"></div>
              <div class="scroll-bar" style="height: 96px;"></div>
            </div>
          </div>
        </div>
      </div>
      <div class="shortcut">
        <div class="shortcut_header">
          <a class="shortcut_panel selected">自定义</a>
          <a class="shortcut_panel">通用</a>
          <span class="icon_close"></span>
        </div>
        <div class="scroll-wrapper shortcut_body scrollbar-macosx" style="position: relative;">
          <div class="shortcut_body scrollbar-macosx scroll-content" data-reactid=".0.5.1.0.1.1" style="height: 583px; margin-bottom: 0px; margin-right: 0px; max-height: none;">
            <div class="shortcut_wrap word_wrap" style="display:block;" data-reactid=".0.5.1.0.1.1.0"></div>
            <div class="shortcut_wrap word_wrap" style="display:none;" data-reactid=".0.5.1.0.1.1.1"></div>
            <div class="shortcut_wrap word_wrap" style="display:none;" data-reactid=".0.5.1.0.1.1.2">
              <div class="shortcut_search_bar" data-reactid=".0.5.1.0.1.1.2.0">
                <div class="shortcut_search_wrap" data-reactid=".0.5.1.0.1.1.2.0.0">
                  <input type="text" class="shortcut_search_input" placeholder="搜索智能回复" value="" data-reactid=".0.5.1.0.1.1.2.0.0.0">
                  <span class="icon_clear" style="display:none;" data-reactid=".0.5.1.0.1.1.2.0.0.1"></span>
                  <span class="icon_loading" style="display:none;" data-reactid=".0.5.1.0.1.1.2.0.0.2"></span>
                  <span class="icon_search" style="display:inline;" data-reactid=".0.5.1.0.1.1.2.0.0.3"></span>
                </div>
              </div>
            </div>
            <div class="short_wrap pic_wrap" style="display:none;" data-reactid=".0.5.1.0.1.1.3"></div>
          </div>
          <div class="scroll-element scroll-x">
            <div class="scroll-element_outer">
              <div class="scroll-element_size"></div>
              <div class="scroll-element_track"></div>
              <div class="scroll-bar"></div>
            </div>
          </div>
          <div class="scroll-element scroll-y">
            <div class="scroll-element_outer">
              <div class="scroll-element_size"></div>
              <div class="scroll-element_track"></div>
              <div class="scroll-bar"></div>
            </div>
          </div>
        </div>
        <div class="shortcut_foot">
          <div class="pagination" style="display:none;">
            <div>
              <span class="page_prev" style="display:inline;">上一页</span>
              <span class="page_show">
                <span data-reactid=".0.5.1.0.1.2.0.0.1.0">0</span>
                <span data-reactid=".0.5.1.0.1.2.0.0.1.1">/</span>
                <span data-reactid=".0.5.1.0.1.2.0.0.1.2">0</span></span>
              <span class="page_next" style="display:none;">下一页</span></div>
          </div>
        </div>
      </div>
      <div ng-show="pagedata.chatinfo.chatid<1" class="chat chat_no_input">
        <div class="chat_not_pick">
          <span class="wx_logo icon icon-liaotian" style="font-size:90px"></span>
          <p class="not_pick_text">未选择聊天</p></div>
      </div>
	  <div ng-show="pagedata.chatinfo.chatid>0">
		<div class="chat">
			<div class="chat_header">
			  <div class="chat_header_items">
				<span class="chat_header_name">{{pagedata.chatinfo.getmember.name}}</span>
				<div class="chat_header_icons">
				  <span class="chat_header_icon icon icon-qiehuan"></span>
				  <span onmouseover="hovermous($(this))" onmouseleave="overmous($(this))" ng-click="post({'id':item.chatid},'del')" class="chat_header_icon icon icon-close"></span>
				  <a ng-if="pagedata.isshow_plans==1" class="tip tip_top" style="position: fixed; left: 1342.5px; top: 176.5px;">结束会话</a></div>
			  </div>
			</div>
			<div class="scroll-wrapper chat_body scrollbar-macosx" style="position: relative;">
			  <div id="svposttext" class="chat_body scrollbar-macosx scroll-content" style="height:100%;margin-bottom: 0px; margin-right: 0px; max-height: none;">
				<div class="chat_body_inner" style="min-height:100%!important">
					<div ng-show="loading" class='infinite-loading'><span class='fui-preloader'></span><span style="margin-left:1.5rem"> 正在加载...</span></div>
				</div>
			  </div>
			  <div class="scroll-element scroll-x">
				<div class="scroll-element_outer">
				  <div class="scroll-element_size"></div>
				  <div class="scroll-element_track"></div>
				  <div class="scroll-bar" style="width: 96px;"></div>
				</div>
			  </div>
			  <div class="scroll-element scroll-y">
				<div class="scroll-element_outer">
				  <div class="scroll-element_size"></div>
				  <div class="scroll-element_track"></div>
				  <div class="scroll-bar" style="height: 96px;"></div>
				</div>
			  </div>
			</div>
    <div class="chat_edit" style="display:block;">
      <div class="chat_edit_items">
        <div class="chat_edit_icons">
          <span href="javascript:;" ng-click="pagedata.upimages()" class="chat_edit_icon icon jinyunicon icon-pic" title="图片"></span>
          <span href="javascript:;" ng-click="pagedata.upfile()" class="chat_edit_icon icon jinyunicon icon-exl" title="文件"></span>
		  <span href="javascript:;" onclick="$('#showqr').modal();" ng-if="pagedata.chatinfo.kefu.showqr" title="客服二维码" class="chat_edit_icon icon jinyunicon icon-qrcode"></span>
		  <span href="javascript:;" onclick="$('#upcomment').modal();" class="chat_edit_icon icon jinyunicon icon-haoping" title="评价"></span>
		</div>
        <div class="chat_edit_shortcut">快捷回复</div>
		<div style="margin-top:10px;"><a href="javascript:;" class="sub-btn" onclick="submitform()" style="font-size:0.65rem">发送</a></div>	  </div>
      <div class="chat_edit_input">
        <div class="scroll-wrapper edit_area scrollbar-macosx" style="position: relative;">
          <pre id="contentvalue" class="edit_area scrollbar-macosx scroll-content" contenteditable="true" style="height: 80px; margin-bottom: 0px; margin-right: 0px; max-height: none;"></pre>
          <div class="scroll-element scroll-x">
            <div class="scroll-element_outer">
              <div class="scroll-element_size"></div>
              <div class="scroll-element_track"></div>
              <div class="scroll-bar" style="width: 96px;"></div>
            </div>
          </div>
          <div class="scroll-element scroll-y">
            <div class="scroll-element_outer">
              <div class="scroll-element_size"></div>
              <div class="scroll-element_track"></div>
              <div class="scroll-bar" style="height: 96px;"></div>
            </div>
          </div>
        </div>
      </div>
      <div class="chat_edit_footer">按Enter发送，Ctrl+Enter换行</div>
  </div>
</div>
    </div>
    <div class="waiting_wrap" style="display:none;">
      <div class="waiting_his_show">
        <div class="waiting_his_header">
          <span>聊天记录</span>
          <span class="icon_close"></span>
        </div>
        <div class="scroll-wrapper waiting_his_body scrollbar-macosx" style="position: relative;">
          <div class="waiting_his_body scrollbar-macosx scroll-content" data-reactid=".0.5.1.1.0.1" style="height: 624px; margin-bottom: 0px; margin-right: 0px; max-height: none;"></div>
          <div class="scroll-element scroll-x">
            <div class="scroll-element_outer">
              <div class="scroll-element_size"></div>
              <div class="scroll-element_track"></div>
              <div class="scroll-bar"></div>
            </div>
          </div>
          <div class="scroll-element scroll-y">
            <div class="scroll-element_outer">
              <div class="scroll-element_size"></div>
              <div class="scroll-element_track"></div>
              <div class="scroll-bar"></div>
            </div>
          </div>
        </div>
      </div>
      <div class="waiting_inner" data-reactid=".0.5.1.1.1">
        <div class="waiting_panel" data-reactid=".0.5.1.1.1.0">
          <a class="setting_panel selected" data-reactid=".0.5.1.1.1.0.0">待接入</a>
          <a class="setting_panel" data-reactid=".0.5.1.1.1.0.1">已过期</a>
          <span class="btn btn_primary" data-reactid=".0.5.1.1.1.0.2">接入</span></div>
        <div class="waiting_box" data-reactid=".0.5.1.1.1.1">
          <div class="scroll-wrapper wait_list scrollbar-macosx" style="position: relative;">
            <div class="wait_list scrollbar-macosx scroll-content" data-reactid=".0.5.1.1.1.1.0" style="height: 560px; margin-bottom: 0px; margin-right: 0px; max-height: none;">
              <table cellspacing="0" class="empty" data-reactid=".0.5.1.1.1.1.0.0">
                <tbody class="wait_list_tbody" data-reactid=".0.5.1.1.1.1.0.0.0">
                  <tr data-reactid=".0.5.1.1.1.1.0.0.0.1">
                    <td class="wait_list_empty" data-reactid=".0.5.1.1.1.1.0.0.0.1.0">
                      <span data-reactid=".0.5.1.1.1.1.0.0.0.1.0.0">暂无接入用户</span></td>
                  </tr>
                </tbody>
              </table>
            </div>
            <div class="scroll-element scroll-x">
              <div class="scroll-element_outer">
                <div class="scroll-element_size"></div>
                <div class="scroll-element_track"></div>
                <div class="scroll-bar"></div>
              </div>
            </div>
            <div class="scroll-element scroll-y">
              <div class="scroll-element_outer">
                <div class="scroll-element_size"></div>
                <div class="scroll-element_track"></div>
                <div class="scroll-bar"></div>
              </div>
            </div>
          </div>
          <div class="wait_bottom" data-reactid=".0.5.1.1.1.1.1">
            <div class="wait_auto_in" data-reactid=".0.5.1.1.1.1.1.0"></div>
            <div class="wait_pagination" style="display:none;" data-reactid=".0.5.1.1.1.1.1.1">
              <span style="display:none;" class="pagination_prev" data-reactid=".0.5.1.1.1.1.1.1.0">上一页</span>
              <span class="pagination_show" data-reactid=".0.5.1.1.1.1.1.1.1">
                <span data-reactid=".0.5.1.1.1.1.1.1.1.0">1</span>
                <span data-reactid=".0.5.1.1.1.1.1.1.1.1">/</span>
                <span data-reactid=".0.5.1.1.1.1.1.1.1.2">1</span></span>
              <span style="display:none;" class="pagination_next" data-reactid=".0.5.1.1.1.1.1.1.2">下一页</span></div>
          </div>
        </div>
      </div>
    </div>
    <div ng-if="pagedata.setting_wrap==1" class="setting_wrap">
      <div class="setting_header" style="display:block;">
        <a class="setting_panel selected">帐号设置</a>
        <a class="setting_panel ">接入设置</a>
        <a class="setting_panel ">离开设置</a>
        <a class="setting_panel ">回复设置</a></div>
      <div class="setting_header tl" ng-if="pagedata.setting_wrap_tab<1">
        <div class="page_nav setting_nav" data-reactid=".0.5.1.2.1.0">
          <a class="icon_goback" data-reactid=".0.5.1.2.1.0.0">返回上一层</a>
          <a data-reactid=".0.5.1.2.1.0.1">帐号设置</a>
          <span class="gap" data-reactid=".0.5.1.2.1.0.2">/</span>
          <span data-reactid=".0.5.1.2.1.0.3">历史数据</span></div>
      </div>
    </div>
    <div class="transfer_popup" style="display:none;">
      <div class="transfer_chosen" data-reactid=".0.5.1.3.0">
        <div class="transfer_header" data-reactid=".0.5.1.3.0.0">请选择要转接的客服</div>
        <div class="scroll-wrapper transfer_cards scrollbar-macosx" style="position: relative;">
          <div class="transfer_cards scrollbar-macosx scroll-content" data-reactid=".0.5.1.3.0.1" style="height: 210px; margin-bottom: 0px; margin-right: 0px; max-height: none;"></div>
          <div class="scroll-element scroll-x">
            <div class="scroll-element_outer">
              <div class="scroll-element_size"></div>
              <div class="scroll-element_track"></div>
              <div class="scroll-bar"></div>
            </div>
          </div>
          <div class="scroll-element scroll-y">
            <div class="scroll-element_outer">
              <div class="scroll-element_size"></div>
              <div class="scroll-element_track"></div>
              <div class="scroll-bar"></div>
            </div>
          </div>
        </div>
        <div class="transfer_inputs" data-reactid=".0.5.1.3.0.2">
          <div class="transfer_header" data-reactid=".0.5.1.3.0.2.0">给客服留言</div>
          <div class="transfer_input" data-reactid=".0.5.1.3.0.2.1">
            <label class="input_wrap" for="transfer_input" data-reactid=".0.5.1.3.0.2.1.0">
              <input type="text" id="transfer_input" data-reactid=".0.5.1.3.0.2.1.0.0">
              <span class="input_count " data-reactid=".0.5.1.3.0.2.1.0.1">
                <span data-reactid=".0.5.1.3.0.2.1.0.1.0">0</span>
                <span data-reactid=".0.5.1.3.0.2.1.0.1.1">/</span>
                <span data-reactid=".0.5.1.3.0.2.1.0.1.2">100</span></span>
            </label>
            <p class="transfer_warn warn" style="display:none;" data-reactid=".0.5.1.3.0.2.1.1">输入的字数已经超过限制。输入的字数已经超过限制。</p>
            <div class="transfer_btn_wrap" data-reactid=".0.5.1.3.0.2.1.2">
              <span class="btn_wrap" data-reactid=".0.5.1.3.0.2.1.2.0">
                <a class="btn btn_primary " data-reactid=".0.5.1.3.0.2.1.2.0.0">转接</a></span>
              <span class="btn_wrap" data-reactid=".0.5.1.3.0.2.1.2.1">
                <a class="btn btn_default" data-reactid=".0.5.1.3.0.2.1.2.1.0">取消</a></span>
            </div>
          </div>
        </div>
      </div>
    </div>
  </div>
</div>
</div>
</div>
<div class="fui-navbar-pc right" style="bottom:180px;margin-left:498px">
		<a href="javascript:;" ng-click="access_json('jy_kefu/home/')" class="external nav-item" ng-class="{'active':page.action=='home'}">
			<i class="icon icon-shouye"></i>
			<div class="text">选择客服</div>
		</a>
		<a href="javascript:;" ng-click="access_json('jy_kefu/mychat/')" class="external nav-item" ng-class="{'active':page.action=='chat'}">
			<i class="icon icon-shuffling-banner" ></i>
			<div class="text">消息管理</div>
			<div class="red-dot" ng-show="pagedata.noreadnum > 0">{{pagedata.noreadnum}}</div>
		</a>		
</div>
<div class="wap-qrcode-left" style="margin-left:498px">
    <p class="example1">我DE对话</p>
    <div class="wap-qrcode-image" id="qrcode-mychaturl" ng-init="qrcode(pagedata,'mychaturl')"><canvas width="256" height="256"></canvas></div>
    <p class="example1">微信“扫一扫”访问</p>
</div>
<div id="followewm" class="modal fade" tabindex="-1" style="z-index:99999;display:none;">
		<div class="modal-dialog" style="width:720px;height:90%;left:50%;top:50%;margin-left:-360px" aria-hidden="true" data-dismiss="modal">
			<div class="images-modal">
			<div class="mod-image" style="">
				<img style="width:100%;" ng-src="{{tomedia(pagedata.textimg)}}"/>
			</div>
			</div>
		</div>
</div>
<div id="upcomment"  class="modal fade" tabindex="-1" style="z-index:99999;display:none;">
		<div class="modal-dialog">
			<div class="modal-content" style="background:#fafafa">
				<div class="fui-line" style="width:6rem;margin:0.5rem auto 0 auto">
					<div class="text text-danger" style="background-color:#fafafa" >评价</div>
				</div>
				<div class="weui_cells weui_cells_radio" style="padding:0.5rem">
					<div class="fui-cell-label" style="margin-right:0.8rem;float:left;margin-bottom:0.2rem">
						<input type="radio" class="fui fui-radio fui-radio-danger verify-radio" name="radio2" ng-click="pagedata.upcommenttype = 0" value="0"> 好评
					</div>
					<div class="fui-cell-label" style="margin-right:0.8rem;float:left;margin-bottom:0.2rem">
						<input type="radio" class="fui fui-radio fui-radio-danger verify-radio" name="radio2" ng-click="pagedata.upcommenttype =1" value="1"> 中评
					</div>
					<div class="fui-cell-label" style="margin-right:0.8rem;float:left;margin-bottom:0.2rem">
						<input type="radio" class="fui fui-radio fui-radio-danger verify-radio" name="radio2" ng-click="pagedata.upcommenttype =2" value="2"> 差评
					</div>
				</div>
				<div class="weui_cells weui_cells_form">
					<div class="weui_cell">
						<div class="weui_cell_bd weui_cell_primary">
							<textarea id="upcommentmsg" class="weui_textarea" placeholder="说点什么吧..." rows="2"></textarea>
							<div class="weui_textarea_counter"><span>0</span>/200</div>
						</div>
					</div>
				</div>
				<div class="modal-footer">
					<div class="mod-check" href="javascript:"  id="upcommentsubmit" aria-hidden="true" data-dismiss="modal">确认</div>
				</div>
			</div>
		</div>
	</div>
</div>
<audio id="openvoice" controls preload="auto" style="display:none;">
	<source src="../core/resource/images/message.mp3"></source>
</audio>
<script type="text/javascript">
function followewm(textimg){
	scope.pagedata.textimg = textimg;
	scope.$evalAsync();
	$('#followewm').modal();
}
var images = {
	localIds: [],
};
var voice = {
	localId: '',
	serverId: ''
};
scope.loading = true;  //状态标记
//获取HTML
scope.pagedata.get_html=function(data){
	scope.get_data(function(res){
		htmlmsg=res.html
		if(htmlmsg){
			$('.chat_body_inner').append(htmlmsg).animate({scrollTop:100000},300);
		}
	},'','/chat/gethtml/id='+data.id+'&chatid='+data.chatid);
}
//前端先注册以等待接收消息
require(['jinyun_socket'],function(jinyun_socket){
    jinyun_socket.connect();
    jinyun_socket.onmessage=function(res){
        if(res.from_uid == scope.pagedata.chatinfo.getmember.id){
				res.message = JSON.parse(res.message)
				scope.pagedata.get_html(res.message);
				$("#openvoice")[0].play();
		}
    }
});
function socketlog(id,chatid) {
		var socketdata = {
			'id':id,
			'chatid':chatid,
		}
		socketdata = JSON.stringify(socketdata)
		require(['jinyun_socket'],function(jinyun_socket){
			jinyun_socket.send2uid(socketdata,scope.pagedata.chatinfo.getmember.id);//向ID为2的用户发送消息
		});
}
scope.pagedata.getchatinfo=function(getmid){
	scope.scroll(function(){
		scope.loading = true;  //状态标记
		console.log('scroll')
		scope.$evalAsync();
		setTimeout('getlist()',1000);
	},true,'svposttext');
	scope.get('/chat//getmid='+getmid+'&get=1',function(res){
		scope.pagedata.chatinfo=res
		getlist(1)
	});
}
if(scope.pagedata.chatinfo.chatid!=0){
	getlist(1)
}
if(scope.pagedata._RQ){
if(scope.pagedata._RQ.getmid){
	var getmid=scope.pagedata._RQ.getmid
	scope.pagedata.getchatinfo(getmid);
}
}
scope.pagedata.upimages=function(){
	scope.tool.up_file('image',function(res){
		addchat(res,4,0);
	});
}
scope.pagedata.upfile=function(){
	scope.tool.up_file('other',function(res){
		addchat(res,7,0);
	});
}
var page=1;
function getlist(e){
	scope.loading = true;
	if(e){
		$('.chat_body_inner').html("");
		page=1
	}else{
		if(scope.pagedata.isnodata){
			scope.loading = false;
			scope.$evalAsync();
			return false;
		}
	}
		var params = {
					'plugin':'jy_kefu',
					'action':'chat',
					'op':'list',
					'query':'page='+page+'&chatid='+scope.pagedata.chatinfo.chatid,
					'data':{},
					'callback':function(data){
							console.log('page');console.log(page)
							if(data.error !=1){
								$('.chat_body_inner').prepend(data.html);
								if(page >1){
									$("#svposttext").animate({scrollTop:0},300);
								}
								if(!data.html){
									scope.pagedata.isnodata=true;
								}
								if(page==1){
									$('#svposttext').animate({scrollTop:100000},300);
								}
								page++;
								scope.loading = false;
								scope.$evalAsync();
								
							}else{
								scope.message(data.msg,'error');
							}
					}
		}
		scope.post_json(params);
}
function addchat(msg,type,audiotime){
			$('#process').hide();
			$('#svtext').hide();$('#svurlbox').hide();$('#svinfolist').hide();
			$('div.mediaFooterbox', $('#sendbox')).show();
			var params = {
					'plugin':'jy_kefu',
					'action':'addchat',
					'data':{
							getmid:scope.pagedata.chatinfo.getmid,
							chatid:scope.pagedata.chatinfo.chatid,
							msg:msg,
							type:type,
							audiotime:audiotime,
					},
					'callback':function(data){
						if(data.error !=1){
							$('#svposttext').show();
							$('.chat_body_inner').append(data.htmlmsg).animate({scrollTop:100000},300);
							$('#contentvalue').html();
							socketlog(data.id,scope.pagedata.chatinfo.chatid);
						}else{
							alert(data.msg);
						}
					}
			}
			scope.post_json(params);	
}
function submitform() {
	//苹果手机键盘归让页面归位
	window.scroll(0,0); //让页面归位
			$('#process').hide();
			$('#svtext').hide();$('#svurlbox').hide();$('#svinfolist').hide();
			$('div.mediaFooterbox', $('#sendbox')).show();
			var text = $('#contentvalue').html();
			$('#contentvalue').html("");
			var addchat = 'addchat';
			var getmid = scope.pagedata.chatinfo.getmid;
			if(!getmid){
				getmid = 0;
				addchat = 'addrobotchat';
			}
			var params = {
					'plugin':'jy_kefu',
					'action':'addchat',
					'data':{
							getmid:getmid,
							chatid:scope.pagedata.chatinfo.chatid,
							msg:text,
							type:1,
					},
					'callback':function(data){
						if(data.error !=1){
							$('#svposttext').show();
							var htmlmsg = '';
							if(data.htmlmsg){
								htmlmsg += data.htmlmsg;
							}
							$('.chat_body_inner').append(htmlmsg).animate({scrollTop:100000},300);
							$('#contentvalue').html();
							socketlog(data.id,scope.pagedata.chatinfo.chatid);
						}else{
							scope.message(data.msg,'error');
						}
					}
			}
			scope.post_json(params);	
}
document.onkeydown=function(event){
    var e = event || window.event || arguments.callee.caller.arguments[0];
	if(e && e.keyCode==13){ // enter 键
        submitform()
    }
}
</script>
<script type="text/javascript">
$(function() {
	window.hovermous = function(div) {
		if(scope.pagedata.isshow_plans==1){
			return false;
		}
		scope.pagedata.isshow_plans=1;
		scope.$evalAsync();
    }
	window.overmous = function(div) {
		scope.pagedata.isshow_plans=0;
		scope.$evalAsync();
	}
});
</script>